//
//  WJVisitorViewController.swift
//  WJWeiBo
//
//  Created by wangjun on 16/7/19.
//  Copyright © 2016年 wangjun. All rights reserved.
//

import UIKit

class WJVisitorViewController: UIViewController {

    var isLogin: Bool = WJUserAccountViewModel.shareTools.isLogin
    
    var visitorView: WJVictorView?
    
    override func loadView() {
        
        isLogin ? (view = tableView) : setupWJVisitorView()
    }
    
    func setupWJVisitorView() {
        
        visitorView = WJVictorView()
        
        view = visitorView
        
        visitorView?.closure = {[weak self] in
            
           self?.loginBtn()
            
        }
        
        setNavigation()
        
    }
    
  @objc private func loginBtn() {
    
    let loginVC: UINavigationController = UINavigationController(rootViewController: WJLoginViewController())
    
    self.presentViewController(loginVC, animated: true, completion: nil)
    
    }
    
    func setNavigation() {
        
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "登陆", imgName: nil, target: self, action: "loginBtn")
        
//        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "登陆", style: UIBarButtonItemStyle.Plain, target: self, action: "loginBtn")
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "注册", style: UIBarButtonItemStyle.Plain, target: self, action: "loginBtn")
        
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()

  
       }
        
        lazy var tableView: UITableView = UITableView()
 

}
